package com.woniumall.service.impl;

import com.woniumall.dao.CategoryDao;
import com.woniumall.pojo.Category;
import com.woniumall.service.CategoryService;
import com.woniumall.util.sqlSessionUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * @auther linke
 * @create 2021-10-28 19:08
 */
public class CategoryServiceImpl implements CategoryService {
    private SqlSession session = null;
    //获得持久层操作对象
    private CategoryDao categoryDao = null;

    @Override
    public List<Category> findAll(){
        session= sqlSessionUtil.sqlSession();
        categoryDao = session.getMapper(CategoryDao.class);
        List<Category> list = categoryDao.findAll();
      /*  for (Category category : list) {
            System.out.println(category);
        }*/
       session.close();
        return list;
    }
}
